Crate bevy_audio
source ·Expand description
Audio support for the game engine Bevy
fn main() {
App::new()
.add_plugins((MinimalPlugins, AssetPlugin::default(), AudioPlugin::default()))
.add_systems(Startup, play_background_audio)
.run();
}
fn play_background_audio(asset_server: Res<AssetServer>, mut commands: Commands) {
commands.spawn(AudioBundle {
source: asset_server.load("background_audio.ogg"),
settings: PlaybackSettings::LOOP,
});
}
Modules§
Structs§
- Loads files as
AudioSource
Assets
- Adds support for audio playback to a Bevy Application
- Used to control audio during playback.
- A source of audio data
- Bundle for playing a sound.
- The default scale factor applied to the positions of audio sources and listeners for spatial audio. Can be overridden for individual sounds in
PlaybackSettings
. - Use this
Resource
to control the global volume of all audio. - A source of sine wave sound
- Initial settings to be used when audio starts playing. If you would like to control the audio while it is playing, query for the
AudioSink
orSpatialAudioSink
components. Changes to this component will not be applied to already-playing audio. - Used to control spatial audio during playback.
- Settings for the listener for spatial audio sources.
- A scale factor applied to the positions of audio sources and listeners for spatial audio.
- A volume level equivalent to a non-negative float.
Enums§
- The way Bevy manages the sound playback.
Traits§
- Common interactions with an audio sink.
- A trait for working generically across different Sample format types.
- A type implementing this trait can be converted to a
rodio::Source
type. It must beSend
andSync
in order to be registered. Types that implement this trait usually contain raw sound data that can be converted into an iterator of samples. This trait is implemented forAudioSource
. Check the exampledecodable
for how to implement this trait on a custom type. - Represents a value of a single sample.
- A source of samples.
Type Aliases§
- Bundle for playing a standard bevy audio asset
- Bundle for playing a bevy note sound